<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>

<fmt:bundle basename="bundle/messages" />

<div id="search-form">
	<form:form action="">
		<table id="search-table">
			<tbody>
			<tr>
				<td><label for="searchQuery">Szukaj:</label></td>
				<td colspan="2"><form:input path="query" id="searchQuery"/></td>
				<td>
					<form:select path="resourceType">
						<c:forEach items="${model.resourceTypes}" var="resourceType">
							<form:option value="${resourceType}" label="type ${resourceType}"/>
						</c:forEach>					
					</form:select>					
				</td>
			</tr>
			<tr>
				<td><label>Tylko aktywni</label><form:checkbox path="activeOnly" value="true"/></td>
				<td>
					<label>szukaj w</label>
					<form:select path="searchType">
					<c:forEach items="${model.searchTypes}" var="searchType">
						<form:option value="${searchType}">
							<fmt:message key="search.label.search.types.${searchType}"/>
						</form:option>
					</c:forEach>
					</form:select>
				</td>
				<td>
					<label>zasoby</label>
					<form:select path="serviceType">
					<c:forEach items="${model.serviceTypes}" var="serviceType">
						<form:option value="${serviceType}">
							<fmt:message key="search.label.service.types.${serviceType}"/>
						</form:option>
					</c:forEach>
					</form:select>
				</td>				
			</tr>
			<tr>
				<td align="right" colspan="4">
					<input type="submit" value="Szukaj" name="search"/>
				</td>
			</tr>
			</tbody>
		</table>

	</form:form>
</div>

<script type="text/javascript">
//<![CDATA[
//Form.Element.focus('searchQuery'); XXXX
//]]>
</script>


<c:if test="${not empty model.searchResponse}">
Wyniki: <br/>
	<c:forEach var="resource" items="${model.searchResponse.results}">
		${resource.name}<br/>
		
		
	</c:forEach>

</c:if>